package pe.gastobien.app.layer.service;
import pe.gastobien.app.domain.User;
import pe.gastobien.app.layer.dao.impl.UserDaoImpl;
import pe.gastobien.app.layer.dao.interfaces.UserDao;


public class UserService {
	
	public User getUserByLogin(String login)
	{
		UserDao dao = new UserDaoImpl();
		return dao.getUserByLogin(login);
	}
	
	
	public Boolean existUser(String login)
	{
		UserDao dao = new UserDaoImpl();
		return dao.existUser(login);
	}
	
	public Boolean Authenticate(String login, String password)
	{
		UserDao dao = new UserDaoImpl();
		User user = dao.getUserByLogin(login);
		if(user != null)
		{
			return user.getPassword().equals(password);					
		}
		
		return false;
	}
}
